import http from '@/utils/http'

const BASE_URL = '/sport/projectReferee'

export interface ProjectRefereeResp {
  id: string
  projectId: string
  projectName: string
  refereeName: string
  refereeId: string
  createUserString: string
  updateUserString: string
}
export interface ProjectRefereeDetailResp {
  id: string
  projectId: string
  refereeId: string
  createTime: string
  createUser: string
  updateTime: string
  updateUser: string
  createUserString: string
  updateUserString: string
}
export interface ProjectRefereeQuery {
  projectId: string
  refereeId: string
  sort: Array<string>
}
export interface ProjectRefereePageQuery extends ProjectRefereeQuery, PageQuery {}

/** @desc 查询项目裁判列表 */
export function listProjectReferee(query: ProjectRefereePageQuery) {
  return http.get<PageRes<ProjectRefereeResp[]>>(`${BASE_URL}`, query)
}

/** @desc 查询项目裁判详情 */
export function getProjectReferee(id: string) {
  return http.get<ProjectRefereeDetailResp>(`${BASE_URL}/${id}`)
}

/** @desc 新增项目裁判 */
export function addProjectReferee(data: any) {
  return http.post(`${BASE_URL}`, data)
}

/** @desc 新增项目裁判 */
export function bathAddProjectReferee(data: any) {
  return http.post(`${BASE_URL}/batchAdd`, data)
}

/** @desc 修改项目裁判 */
export function updateProjectReferee(data: any, id: string) {
  return http.put(`${BASE_URL}/${id}`, data)
}

/** @desc 删除项目裁判 */
export function deleteProjectReferee(id: string) {
  return http.del(`${BASE_URL}/${id}`)
}

/** @desc 导出项目裁判 */
export function exportProjectReferee(query: ProjectRefereeQuery) {
  return http.download<any>(`${BASE_URL}/export`, query)
}
